package net.wofly.right.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import net.wofly.right.domain.FuncInit;
import net.wofly.right.repository.FuncInitRepository;
import net.wofly.right.service.IFuncInitService;

/**
 * Desc:
 * Created by LiuJianbo on 2017/11/2.
 */
@Service("iFuncInitService")
@Transactional
public class FuncInitServiceImpl implements IFuncInitService {

    @Autowired
    FuncInitRepository repository;

    @Override
    public FuncInit save(FuncInit entity) {
        return repository.save(entity);
    }

    @Override
    public void delete(FuncInit entity) {
        repository.delete(entity);
    }

    @Override
    public void delete(String key) {
        repository.delete(key);
    }

    @Override
    public FuncInit findOne(String key) {
        return repository.findOne(key);
    }

    @Override
    public List<FuncInit> save(List<FuncInit> entityList) {
        return (List<FuncInit>) repository.save(entityList);
    }

    @Override
    public List<FuncInit> findAll() {
        return (List<FuncInit>) repository.findAll();
    }

    @Override
    public List<FuncInit> findAllBySortAsc() {
        return (List<FuncInit>)repository.findAll(new Sort(Sort.Direction.ASC,"sort"));
    }
}
